1 Geographic Boundary

1.1 Description

  • Scotland has its own names and theresholds for the Census boundaries.
  • It is different from England and Wales.
  • Output Areas (OAs) in Scotland are based on both population and household but Data Zone (DZ) and Intermediate Zone (IZ) are based on poulation only.
  • In England, OAs, LSOAs, and MSOAs are all based on both population and household.
  • For more information, please visit: https://scotborders.gov.uk/info/20015/your_council/65/research_and_data/5

1.2 What does Glasgow look like?

  • Output Areas: 5486 for Glasgow (11.8%); 46,351 for the whole of Scotland
  • Data Zones: 746 for Glasgow (10.6%); 6976 covering the whole of Scotland
  • Intermediate Zones: 136 for Glasgow (10.6%); 1,279 covering the whole of Scotland.
Country Boundary Name Pop-Min Pop-Max Household-Min Household-Max Total No.Scot 11’ Total No. Glasgow 11’
Scotland Output Area 50 - 20 - 46351 5486
Datazone 500 1000 - - 6976 746
Intermediate Zone 2500 6000 - - 1279 136
England Output Area 100 - 40 - 181408 -
Lower Super Output Area 1000 3000 400 1200 34753 -
Middle Super Output Area 5000 15000 2000 6000 7201 -

2 Schools

Call files: primary schools and intermediate zones

schools <- 
  read_sf("Glasgow/Bld_Schools_Glasgow.shp") %>% 
  select(-c(FID_1, FID_2)) %>% 
  mutate(FID = row_number()) %>% 
  select(FID, everything())

iz <- read_sf("Glasgow/Glasgow_IZ.shp")
code <- read_csv("Glasgow/dz2011_codes_and_labels_21042020.csv")
## Rows: 6976 Columns: 11
## ── Column specification ────────────────────────────────────────────────────────
## Delimiter: ","
## chr (11): DataZone, DataZoneName, IntZone, IntZoneName, CA, CAName, HSCP, HS...
## 
## ℹ Use `spec()` to retrieve the full column specification for this data.
## ℹ Specify the column types or set `show_col_types = FALSE` to quiet this message.

Taking a glance on the data

schools %>%
  st_drop_geometry() %>%
  glimpse()
## Rows: 318
## Columns: 81
## $ FID        <int> 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, …
## $ id         <chr> "0D4F710245D627B3E050A00A568A259B", "0D4F7107E62B27B3E050A0…
## $ featcode   <dbl> 15014, 15014, 15014, 15014, 15014, 15014, 15014, 15014, 150…
## $ area       <dbl> 2629, 30, 31, 39, 1613, 65, 3075, 40, 25, 29, 1664, 1413, 5…
## $ DataZone   <chr> "S01010452", "S01010452", "S01010452", "S01010463", "S01010…
## $ LAName     <chr> "Glasgow City", "Glasgow City", "Glasgow City", "Glasgow Ci…
## $ SAPE2014   <dbl> 785, 785, 785, 823, 823, 823, 670, 596, 596, 596, 596, 1008…
## $ WASAPE2014 <dbl> 436, 436, 436, 514, 514, 514, 401, 359, 359, 359, 359, 603,…
## $ Rank       <dbl> 1554, 1554, 1554, 3317, 3317, 3317, 1285, 1692, 1692, 1692,…
## $ Quintile   <dbl> 2, 2, 2, 3, 3, 3, 1, 2, 2, 2, 2, 3, 3, 1, 1, 1, 1, 1, 1, 2,…
## $ Decile     <dbl> 3, 3, 3, 5, 5, 5, 2, 3, 3, 3, 3, 5, 5, 1, 2, 1, 1, 1, 1, 3,…
## $ Vigintile  <dbl> 5, 5, 5, 10, 10, 10, 4, 5, 5, 5, 5, 10, 10, 1, 3, 1, 1, 1, …
## $ Percentile <dbl> 23, 23, 23, 48, 48, 48, 19, 25, 25, 25, 25, 48, 48, 2, 14, …
## $ IncRate    <dbl> 0.23, 0.23, 0.23, 0.11, 0.11, 0.11, 0.26, 0.20, 0.20, 0.20,…
## $ IncNumDep  <dbl> 180, 180, 180, 85, 85, 85, 175, 120, 120, 120, 120, 110, 11…
## $ IncRank    <dbl> 1092, 1092, 1092, 3325, 3325, 3325, 754, 1403, 1403, 1403, …
## $ EmpRate    <dbl> 0.19, 0.19, 0.19, 0.10, 0.10, 0.10, 0.16, 0.16, 0.16, 0.16,…
## $ EmpNumDep  <dbl> 85, 85, 85, 50, 50, 50, 65, 60, 60, 60, 60, 55, 55, 95, 70,…
## $ EmpRank    <dbl> 1113, 1113, 1113, 3059, 3059, 3059, 1689, 1587, 1587, 1587,…
## $ HlthCIF    <dbl> 165, 165, 165, 130, 130, 130, 165, 165, 165, 165, 165, 115,…
## $ HlthAlcSR  <dbl> 138.82534, 138.82534, 138.82534, 63.99475, 63.99475, 63.994…
## $ HlthDrugSR <dbl> 0.00000, 0.00000, 0.00000, 0.00000, 0.00000, 0.00000, 0.000…
## $ HlthSMR    <dbl> 117, 117, 117, 96, 96, 96, 148, 80, 80, 80, 80, 97, 97, 208…
## $ HlthDprsPc <dbl> 0.2152866, 0.2152866, 0.2152866, 0.1822600, 0.1822600, 0.18…
## $ HlthLBWTPc <dbl> 0.02941176, 0.02941176, 0.02941176, 0.00000000, 0.00000000,…
## $ HlthEmrgSR <dbl> 109.4836, 109.4836, 109.4836, 112.8559, 112.8559, 112.8559,…
## $ HlthRank   <dbl> 1734, 1734, 1734, 2731, 2731, 2731, 1549, 1855, 1855, 1855,…
## $ EduAttend  <dbl> 0.8539326, 0.8539326, 0.8539326, 0.8423913, 0.8423913, 0.84…
## $ EduAttain  <dbl> 5.500000, 5.500000, 5.500000, 5.083333, 5.083333, 5.083333,…
## $ EduNoQuals <dbl> 153.0186, 153.0186, 153.0186, 101.8701, 101.8701, 101.8701,…
## $ EduNEET    <dbl> 0.03, 0.03, 0.03, 0.03, 0.03, 0.03, 0.28, 0.04, 0.04, 0.04,…
## $ EduHESA    <dbl> 0.04615385, 0.04615385, 0.04615385, 0.12598425, 0.12598425,…
## $ EduRank    <dbl> 2793, 2793, 2793, 3469, 3469, 3469, 1057, 2683, 2683, 2683,…
## $ GAccPetrol <dbl> 4.322612, 4.322612, 4.322612, 3.241190, 3.241190, 3.241190,…
## $ GAccDTGP   <dbl> 1.2484531, 1.2484531, 1.2484531, 2.5301074, 2.5301074, 2.53…
## $ GAccDTPost <dbl> 1.892881, 1.892881, 1.892881, 1.843244, 1.843244, 1.843244,…
## $ GAccDTPsch <dbl> 1.5095087, 1.5095087, 1.5095087, 1.2702325, 1.2702325, 1.27…
## $ GAccDTRet  <dbl> 3.631134, 3.631134, 3.631134, 3.581010, 3.581010, 3.581010,…
## $ GAccDTSsch <dbl> 4.962037, 4.962037, 4.962037, 3.174072, 3.174072, 3.174072,…
## $ GAccPTGP   <dbl> 4.573739, 4.573739, 4.573739, 7.476432, 7.476432, 7.476432,…
## $ GAccPTPost <dbl> 5.335732, 5.335732, 5.335732, 5.875810, 5.875810, 5.875810,…
## $ GAccPTRet  <dbl> 11.372774, 11.372774, 11.372774, 11.879900, 11.879900, 11.8…
## $ GAccRank   <dbl> 5571, 5571, 5571, 4955, 4955, 4955, 5520, 4951, 4951, 4951,…
## $ CrimeCount <dbl> 12.01810, 12.01810, 12.01810, 20.03017, 20.03017, 20.03017,…
## $ CrimeRate  <dbl> 153.0968, 153.0968, 153.0968, 243.3799, 243.3799, 243.3799,…
## $ CrimeRank  <dbl> 4305, 4305, 4305, 3033, 3033, 3033, 2179, 552, 552, 552, 55…
## $ HouseNumOC <dbl> 148, 148, 148, 160, 160, 160, 110, 61, 61, 61, 61, 153, 153…
## $ HouseNumNC <dbl> 8, 8, 8, 9, 9, 9, 17, 1, 1, 1, 1, 11, 11, 10, 16, 30, 3, 3,…
## $ HouseOCrat <dbl> 0.18204182, 0.18204182, 0.18204182, 0.20100503, 0.20100503,…
## $ HouseNCrat <dbl> 0.009840098, 0.009840098, 0.009840098, 0.011306533, 0.01130…
## $ HouseRank  <dbl> 1328, 1328, 1328, 1019, 1019, 1019, 1347, 3687, 3687, 3687,…
## $ Shape_Leng <dbl> 2953.927, 2953.927, 2953.927, 2850.157, 2850.157, 2850.157,…
## $ Shape_Area <dbl> 142069.8, 142069.8, 142069.8, 180664.8, 180664.8, 180664.8,…
## $ AB         <dbl> 54, 54, 54, 118, 118, 118, 62, 41, 41, 41, 41, 58, 58, 6, 1…
## $ C1         <dbl> 180, 180, 180, 136, 136, 136, 96, 120, 120, 120, 120, 199, …
## $ C2         <dbl> 109, 109, 109, 119, 119, 119, 70, 93, 93, 93, 93, 175, 175,…
## $ DE         <dbl> 131, 131, 131, 116, 116, 116, 183, 105, 105, 105, 105, 171,…
## $ OID_       <dbl> 3946, 3946, 3946, 3957, 3957, 3957, 3965, 3974, 3974, 3974,…
## $ All_age    <dbl> 813, 813, 813, 796, 796, 796, 666, 623, 623, 623, 623, 1010…
## $ X0_4       <dbl> 36, 36, 36, 44, 44, 44, 40, 25, 25, 25, 25, 62, 62, 47, 54,…
## $ X5_7       <dbl> 25, 25, 25, 14, 14, 14, 28, 17, 17, 17, 17, 33, 33, 24, 37,…
## $ X8_9       <dbl> 14, 14, 14, 19, 19, 19, 12, 8, 8, 8, 8, 28, 28, 18, 11, 19,…
## $ X10_14     <dbl> 30, 30, 30, 44, 44, 44, 36, 55, 55, 55, 55, 58, 58, 48, 47,…
## $ F7         <dbl> 7, 7, 7, 10, 10, 10, 14, 13, 13, 13, 13, 14, 14, 13, 12, 16…
## $ X16_17     <dbl> 22, 22, 22, 24, 24, 24, 11, 17, 17, 17, 17, 16, 16, 25, 20,…
## $ X18_19     <dbl> 15, 15, 15, 20, 20, 20, 16, 15, 15, 15, 15, 25, 25, 26, 23,…
## $ X20_24     <dbl> 51, 51, 51, 39, 39, 39, 31, 19, 19, 19, 19, 52, 52, 34, 48,…
## $ X25_29     <dbl> 31, 31, 31, 36, 36, 36, 51, 27, 27, 27, 27, 39, 39, 27, 60,…
## $ X30_44     <dbl> 148, 148, 148, 136, 136, 136, 137, 126, 126, 126, 126, 173,…
## $ X45_59     <dbl> 153, 153, 153, 191, 191, 191, 127, 119, 119, 119, 119, 233,…
## $ X60_64     <dbl> 54, 54, 54, 43, 43, 43, 38, 38, 38, 38, 38, 65, 65, 16, 34,…
## $ X65_74     <dbl> 95, 95, 95, 78, 78, 78, 61, 56, 56, 56, 56, 80, 80, 54, 27,…
## $ X75_84     <dbl> 98, 98, 98, 61, 61, 61, 44, 65, 65, 65, 65, 87, 87, 19, 0, …
## $ X85_89     <dbl> 25, 25, 25, 24, 24, 24, 14, 20, 20, 20, 20, 32, 32, 9, 1, 1…
## $ X90plus    <dbl> 9, 9, 9, 13, 13, 13, 6, 3, 3, 3, 3, 13, 13, 2, 2, 3, 1, 1, …
## $ House_nm   <dbl> 408, 408, 408, 376, 376, 376, 316, 285, 285, 285, 285, 432,…
## $ no_car     <dbl> 199, 199, 199, 129, 129, 129, 149, 107, 107, 107, 107, 163,…
## $ one_car    <dbl> 162, 162, 162, 178, 178, 178, 141, 127, 127, 127, 127, 173,…
## $ two_cars   <dbl> 41, 41, 41, 57, 57, 57, 23, 45, 45, 45, 45, 79, 79, 12, 35,…
## $ three_car  <dbl> 6, 6, 6, 12, 12, 12, 3, 6, 6, 6, 6, 17, 17, 2, 6, 1, 6, 6, …
## $ Zone       <chr> "S01010452", "S01010452", "S01010452", "S01010463", "S01010…

Summary stats

schools %>%
  st_drop_geometry() %>% 
  get_summary_stats() %>% 
  print(n = Inf) 
## # A tibble: 77 × 13
##    variable      n   min     max  median      q1      q3     iqr     mad    mean
##    <chr>     <dbl> <dbl>   <dbl>   <dbl>   <dbl>   <dbl>   <dbl>   <dbl>   <dbl>
##  1 AB          318     0 3.2 e+2 5.15e+1 1.92e+1 9.4 e+1 7.48e+1 5.12e+1 7.23e+1
##  2 All_age     318     0 1.13e+3 7.56e+2 6.40e+2 8.86e+2 2.46e+2 1.88e+2 7.49e+2
##  3 area        318    23 8.31e+3 6.84e+2 8.12e+1 1.95e+3 1.87e+3 9.55e+2 1.08e+3
##  4 C1          318     0 5.91e+2 1.51e+2 1.05e+2 2.01e+2 9.6 e+1 6.97e+1 1.57e+2
##  5 C2          318     0 1.97e+2 9.6 e+1 6.8 e+1 1.2 e+2 5.2 e+1 3.63e+1 9.33e+1
##  6 CrimeCou…   318     0 2.19e+2 2.50e+1 1.60e+1 4.51e+1 2.90e+1 1.93e+1 3.39e+1
##  7 CrimeRank   318     0 6.89e+3 1.76e+3 7.32e+2 3.35e+3 2.62e+3 1.76e+3 2.10e+3
##  8 CrimeRate   318     0 3.10e+3 3.44e+2 1.98e+2 5.53e+2 3.56e+2 2.42e+2 4.15e+2
##  9 DE          318     0 4.02e+2 1.82e+2 1.15e+2 2.34e+2 1.19e+2 8.30e+1 1.78e+2
## 10 Decile      318     0 1   e+1 2   e+0 1   e+0 4.75e+0 3.75e+0 1.48e+0 3.00e+0
## 11 EduAttain   318     0 6.5 e+0 5.08e+0 4.57e+0 5.47e+0 8.96e-1 6.25e-1 4.72e+0
## 12 EduAttend   318     0 9.84e-1 7.68e-1 7.11e-1 8.44e-1 1.33e-1 1.06e-1 7.22e-1
## 13 EduHESA     318     0 2.34e-1 5.4 e-2 3   e-2 8.9 e-2 5.9 e-2 4.3 e-2 6.1 e-2
## 14 EduNEET     318     0 3.7 e-1 8   e-2 4   e-2 1.4 e-1 1   e-1 5.9 e-2 9.6 e-2
## 15 EduNoQua…   318     0 3.03e+2 1.58e+2 1.01e+2 2.06e+2 1.04e+2 8.02e+1 1.48e+2
## 16 EduRank     318     0 6.85e+3 1.41e+3 4.85e+2 3.14e+3 2.65e+3 1.81e+3 1.91e+3
## 17 EmpNumDep   318     0 3.2 e+2 8.5 e+1 5   e+1 1.25e+2 7.5 e+1 5.19e+1 9.11e+1
## 18 EmpRank     318     0 6.98e+3 1.13e+3 3.28e+2 2.78e+3 2.46e+3 1.39e+3 1.76e+3
## 19 EmpRate     318     0 4.1 e-1 1.7 e-1 9   e-2 2.5 e-1 1.6 e-1 1.19e-1 1.71e-1
## 20 F7          318     0 2.6 e+1 8   e+0 4   e+0 1.1 e+1 7   e+0 4.45e+0 7.91e+0
## 21 featcode    318 15014 1.50e+4 1.50e+4 1.50e+4 1.50e+4 0       0       1.50e+4
## 22 FID         318     1 3.18e+2 1.60e+2 8.02e+1 2.39e+2 1.58e+2 1.18e+2 1.60e+2
## 23 GAccDTGP    318     0 6.20e+0 1.98e+0 1.50e+0 2.64e+0 1.14e+0 8.52e-1 2.07e+0
## 24 GAccDTPo…   318     0 4.74e+0 2.13e+0 1.65e+0 2.47e+0 8.18e-1 6.71e-1 2.02e+0
## 25 GAccDTPs…   318     0 2.93e+0 1.34e+0 1.04e+0 1.67e+0 6.3 e-1 4.72e-1 1.36e+0
## 26 GAccDTRet   318     0 7.92e+0 3.31e+0 2.24e+0 3.97e+0 1.73e+0 1.29e+0 3.15e+0
## 27 GAccDTSs…   318     0 8.25e+0 3.76e+0 2.96e+0 4.77e+0 1.80e+0 1.29e+0 3.77e+0
## 28 GAccPetr…   318     0 5.20e+0 2.52e+0 1.90e+0 3.46e+0 1.56e+0 1.19e+0 2.59e+0
## 29 GAccPTGP    318     0 1.49e+1 6.63e+0 4.77e+0 8.76e+0 3.99e+0 2.83e+0 6.70e+0
## 30 GAccPTPo…   318     0 1.32e+1 6.62e+0 5.45e+0 8.07e+0 2.62e+0 1.90e+0 6.54e+0
## 31 GAccPTRet   318     0 1.97e+1 9.06e+0 6.75e+0 1.14e+1 4.62e+0 3.41e+0 8.86e+0
## 32 GAccRank    318     0 6.97e+3 4.95e+3 3.75e+3 6.00e+3 2.26e+3 1.77e+3 4.65e+3
## 33 HlthAlcSR   318     0 1.70e+3 1.39e+2 6.84e+1 2.54e+2 1.86e+2 1.41e+2 1.84e+2
## 34 HlthCIF     318     0 3.4 e+2 1.65e+2 1.1 e+2 2.15e+2 1.05e+2 7.41e+1 1.57e+2
## 35 HlthDprs…   318     0 3.34e-1 2.12e-1 1.62e-1 2.51e-1 8.9 e-2 6.5 e-2 1.99e-1
## 36 HlthDrug…   318     0 7.52e+2 7.69e+1 2.77e+1 2.06e+2 1.79e+2 1.14e+2 1.33e+2
## 37 HlthEmrg…   318     0 3.24e+2 1.26e+2 1.03e+2 1.51e+2 4.83e+1 3.71e+1 1.24e+2
## 38 HlthLBWT…   318     0 1.74e-1 5.3 e-2 2.2 e-2 9.5 e-2 7.3 e-2 5.1 e-2 5.8 e-2
## 39 HlthRank    318     0 6.29e+3 1.04e+3 2.94e+2 2.50e+3 2.21e+3 1.33e+3 1.54e+3
## 40 HlthSMR     318     0 3.12e+2 1.25e+2 8.9 e+1 1.48e+2 5.88e+1 4.30e+1 1.22e+2
## 41 House_nm    318     0 7.03e+2 3.82e+2 2.94e+2 4.46e+2 1.52e+2 1.11e+2 3.66e+2
## 42 HouseNCr…   318     0 1.3 e-1 2.4 e-2 1   e-2 4.7 e-2 3.7 e-2 2.3 e-2 3   e-2
## 43 HouseNum…   318     0 1.22e+2 1.8 e+1 8   e+0 3.48e+1 2.68e+1 1.78e+1 2.39e+1
## 44 HouseNum…   318     0 4.18e+2 1.53e+2 1.05e+2 2.22e+2 1.17e+2 8.30e+1 1.62e+2
## 45 HouseOCr…   318     0 4.81e-1 2.07e-1 1.49e-1 2.63e-1 1.14e-1 8.5 e-2 2.08e-1
## 46 HouseRank   318     0 5.86e+3 6.48e+2 2.70e+2 1.31e+3 1.04e+3 6.69e+2 1.00e+3
## 47 IncNumDep   318     0 4.65e+2 1.6 e+2 8.5 e+1 2.35e+2 1.5 e+2 1.11e+2 1.66e+2
## 48 IncRank     318     0 6.97e+3 1.05e+3 3.38e+2 2.43e+3 2.09e+3 1.25e+3 1.63e+3
## 49 IncRate     318     0 4.9 e-1 2.1 e-1 1.1 e-1 3   e-1 1.9 e-1 1.41e-1 2.07e-1
## 50 no_car      318     0 5.39e+2 1.88e+2 1.27e+2 2.58e+2 1.30e+2 9.34e+1 1.92e+2
## 51 OID_        318     0 3.99e+3 3.59e+3 3.39e+3 3.76e+3 3.64e+2 2.62e+2 3.39e+3
## 52 one_car     318     0 2.52e+2 1.35e+2 1.02e+2 1.69e+2 6.65e+1 4.89e+1 1.33e+2
## 53 Percenti…   318     0 9.9 e+1 1.6 e+1 5   e+0 4.08e+1 3.58e+1 1.78e+1 2.52e+1
## 54 Quintile    318     0 5   e+0 1   e+0 1   e+0 2.75e+0 1.75e+0 0       1.77e+0
## 55 Rank        318     0 6.87e+3 1.06e+3 3.03e+2 2.82e+3 2.52e+3 1.25e+3 1.72e+3
## 56 SAPE2014    318     0 1.2 e+3 7.85e+2 6.44e+2 9.05e+2 2.61e+2 2.05e+2 7.51e+2
## 57 Shape_Ar…   318     0 8.82e+5 1.63e+5 8.59e+4 2.59e+5 1.73e+5 1.19e+5 2.00e+5
## 58 Shape_Le…   318     0 7.21e+3 2.50e+3 1.89e+3 2.97e+3 1.08e+3 8.11e+2 2.58e+3
## 59 three_car   318     0 4.4 e+1 4   e+0 2   e+0 7   e+0 5   e+0 4.45e+0 6.18e+0
## 60 two_cars    318     0 1.3 e+2 2.8 e+1 1.7 e+1 4.6 e+1 2.9 e+1 1.93e+1 3.48e+1
## 61 Vigintile   318     0 2   e+1 4   e+0 1   e+0 8.75e+0 7.75e+0 4.45e+0 5.40e+0
## 62 WASAPE20…   318     0 1.03e+3 5.13e+2 4.28e+2 6.22e+2 1.94e+2 1.35e+2 5.02e+2
## 63 X0_4        318     0 1.06e+2 3.9 e+1 2.9 e+1 5.2 e+1 2.3 e+1 1.78e+1 4.08e+1
## 64 X10_14      318     0 1.11e+2 3.95e+1 2.6 e+1 4.97e+1 2.38e+1 2.00e+1 3.91e+1
## 65 X16_17      318     0 4.4 e+1 1.6 e+1 1   e+1 2.2 e+1 1.2 e+1 8.90e+0 1.57e+1
## 66 X18_19      318     0 1.44e+2 1.9 e+1 1.5 e+1 2.5 e+1 1   e+1 7.41e+0 2.03e+1
## 67 X20_24      318     0 4.42e+2 5.3 e+1 4.1 e+1 7.18e+1 3.08e+1 1.93e+1 6.11e+1
## 68 X25_29      318     0 2.16e+2 5.5 e+1 3.75e+1 8.2 e+1 4.45e+1 3.11e+1 6.39e+1
## 69 X30_44      318     0 2.95e+2 1.58e+2 1.26e+2 1.95e+2 6.9 e+1 5.04e+1 1.58e+2
## 70 X45_59      318     0 2.86e+2 1.53e+2 1.18e+2 1.86e+2 6.75e+1 5.12e+1 1.46e+2
## 71 X5_7        318     0 6.5 e+1 2   e+1 1.3 e+1 2.8 e+1 1.5 e+1 1.04e+1 2.10e+1
## 72 X60_64      318     0 9.6 e+1 3.8 e+1 2.72e+1 5.1 e+1 2.38e+1 1.78e+1 3.91e+1
## 73 X65_74      318     0 1.41e+2 6   e+1 3.7 e+1 8.6 e+1 4.9 e+1 3.41e+1 6.16e+1
## 74 X75_84      318     0 1.17e+2 4.1 e+1 2.33e+1 6.35e+1 4.03e+1 3.11e+1 4.39e+1
## 75 X8_9        318     0 5   e+1 1.2 e+1 8   e+0 1.9 e+1 1.1 e+1 7.41e+0 1.37e+1
## 76 X85_89      318     0 4.3 e+1 9   e+0 4   e+0 1.6 e+1 1.2 e+1 8.90e+0 1.07e+1
## 77 X90plus     318     0 3.2 e+1 4   e+0 1   e+0 8.5 e+0 7.5 e+0 4.45e+0 5.32e+0
## # … with 3 more variables: sd <dbl>, se <dbl>, ci <dbl>

Rank by IZs

left_join(schools, code, by = "DataZone") %>% 
  select(FID, DataZone, IntZone, IntZoneName) %>% 
  rename(InterZone = IntZone) -> sch

sch %>% 
  group_by(InterZone, IntZoneName) %>% 
  summarise(no_of_schools = length(FID)) -> schools_area
## `summarise()` has grouped output by 'InterZone'. You can override using the `.groups` argument.
schools_area$no_of_schools %>% sum
## [1] 318
schools_area %>%
  st_drop_geometry() %>% 
  arrange(desc(no_of_schools)) %>% 
  print(n = Inf)
## # A tibble: 101 × 3
## # Groups:   InterZone [101]
##     InterZone IntZoneName                             no_of_schools
##     <chr>     <chr>                                           <int>
##   1 <NA>      <NA>                                               20
##   2 S02001886 Cathcart                                            8
##   3 S02001909 Greenfield                                          8
##   4 S02001935 Anderston                                           8
##   5 S02001872 Langside                                            7
##   6 S02001894 Parkhead West and Barrowfield                       7
##   7 S02001855 Drumoyne and Shieldhall                             6
##   8 S02001915 Craigend and Ruchazie                               6
##   9 S02001927 Dennistoun North                                    6
##  10 S02001946 Summerston North                                    6
##  11 S02001961 Whiteinch                                           6
##  12 S02001846 Crookston South                                     5
##  13 S02001902 Garrowhill West                                     5
##  14 S02001922 Springburn                                          5
##  15 S02001925 Sighthill                                           5
##  16 S02001843 Darnley North                                       4
##  17 S02001864 Pollokshields East                                  4
##  18 S02001865 Govanhill West                                      4
##  19 S02001873 Pollokshaws                                         4
##  20 S02001877 Merrylee and Millbrae                               4
##  21 S02001884 Kingspark South                                     4
##  22 S02001889 Gorbals and Hutchesontown                           4
##  23 S02001899 Mount Vernon North and Sandyhills                   4
##  24 S02001901 Baillieston East                                    4
##  25 S02001911 Tollcross                                           4
##  26 S02001913 Carntyne                                            4
##  27 S02001917 Blackhill and Barmulloch East                       4
##  28 S02001926 Roystonhill, Blochairn, and Provanmill              4
##  29 S02001928 Alexandra Parade                                    4
##  30 S02001951 North Kelvin                                        4
##  31 S02001972 Blairdardie East                                    4
##  32 S02001853 Penilee                                             3
##  33 S02001857 Craigton                                            3
##  34 S02001859 Ibrox                                               3
##  35 S02001860 Ibrox East and Cessnock                             3
##  36 S02001861 Kinning Park and Festival Park                      3
##  37 S02001863 Pollokshields West                                  3
##  38 S02001866 Govanhill East and Aikenhead                        3
##  39 S02001870 Shawlands West                                      3
##  40 S02001876 Newlands                                            3
##  41 S02001883 Castlemilk                                          3
##  42 S02001888 Toryglen and Oatlands                               3
##  43 S02001890 Laurieston and Tradeston                            3
##  44 S02001898 Carmyle and Mount Vernon South                      3
##  45 S02001908 Barlanark                                           3
##  46 S02001919 Balornock                                           3
##  47 S02001920 Barmulloch                                          3
##  48 S02001921 Petershill                                          3
##  49 S02001938 Woodside                                            3
##  50 S02001941 Ruchill                                             3
##  51 S02001945 Summerston Central and West                         3
##  52 S02001947 Maryhill East                                       3
##  53 S02001948 Maryhill West                                       3
##  54 S02001952 Kelvingrove and University                          3
##  55 S02001967 Knightswood East                                    3
##  56 S02001969 Knightswood Park East                               3
##  57 S02001970 Anniesland East                                     3
##  58 S02001977 Drumry West                                         3
##  59 S02001845 Nitshill                                            2
##  60 S02001847 Crookston North                                     2
##  61 S02001849 Pollok North and East                               2
##  62 S02001850 Cardonald South and East                            2
##  63 S02001854 Hillington                                          2
##  64 S02001858 Mosspark                                            2
##  65 S02001862 Kingston West and Dumbreck                          2
##  66 S02001874 Carnwadric West                                     2
##  67 S02001881 Glenwood South                                      2
##  68 S02001885 Kingspark North                                     2
##  69 S02001896 Braidfauld                                          2
##  70 S02001900 Baillieston West                                    2
##  71 S02001903 Garrowhill East and Swinton                         2
##  72 S02001905 Central Easterhouse                                 2
##  73 S02001930 Dennistoun                                          2
##  74 S02001932 City Centre East                                    2
##  75 S02001934 City Centre South                                   2
##  76 S02001943 Milton West                                         2
##  77 S02001955 Partick                                             2
##  78 S02001959 Broomhill                                           2
##  79 S02001973 Blairdardie West                                    2
##  80 S02001975 Drumchapel North                                    2
##  81 S02001842 Darnley East                                        1
##  82 S02001852 Cardonald West and Central                          1
##  83 S02001868 Strathbungo                                         1
##  84 S02001880 Carmunnock South                                    1
##  85 S02001882 Glenwood North                                      1
##  86 S02001887 Mount Florida                                       1
##  87 S02001892 Bridgeton                                           1
##  88 S02001893 Dalmarnock                                          1
##  89 S02001907 North Barlanark and Easterhouse South               1
##  90 S02001914 Cranhill, Lightburn and Queenslie South             1
##  91 S02001923 Springburn East and Cowlairs                        1
##  92 S02001924 Cowlairs and Port Dundas                            1
##  93 S02001933 City Centre West                                    1
##  94 S02001942 Possil Park                                         1
##  95 S02001953 Hillhead                                            1
##  96 S02001960 Victoria Park                                       1
##  97 S02001962 Scotstoun North and East                            1
##  98 S02001964 Yoker South                                         1
##  99 S02001966 Knightswood West                                    1
## 100 S02001971 Anniesland West                                     1
## 101 S02001976 Drumry East                                         1

Plot

schools_area %>% st_drop_geometry() -> sch_df
  
iz %>% 
  left_join(sch_df, by = "InterZone") -> schools_choropleth

schools_choropleth %>% 
  ggplot() +
  geom_sf(aes(fill = no_of_schools),
          show.legend = NA) +
  theme_bw() +
  scale_fill_continuous(low="thistle2", high="darkred", 
                        guide="colorbar",na.value="white") +
  theme(legend.position = "bottom") -> schools_plotly

ggplotly(schools_plotly)